package com.sunday.proxypatterns.staticProxy.service.impl;

import com.sunday.proxypatterns.request.RequestInfo;
import com.sunday.proxypatterns.staticProxy.service.UserService;

/**
  @program: design-patterns
  @author: Jh
  @create: 2021-09-07 10:41
*/
public class UserServiceImpl implements UserService {

    @Override
    public RequestInfo login(String userName, String password) {
        long startTime = System.currentTimeMillis();
        // 登录逻辑
        // userDao.login(userName,password);
        long endTime = System.currentTimeMillis();

        long responseTime = endTime - startTime;
        return new RequestInfo("login",startTime,responseTime);
    }

    @Override
    public RequestInfo register(String userName, String password) {
        long startTime = System.currentTimeMillis();
        // 登录逻辑
        // userDao.register(userName,password);
        long endTime = System.currentTimeMillis();

        long responseTime = endTime - startTime;
        return new RequestInfo("register",startTime,responseTime);
    }
}
